package com.ruoyi.web.controller.Game;

import com.ruoyi.CustomSpringUtils;
import com.ruoyi.system.buffer.GameData;
import com.ruoyi.system.event.GameResquestEvent;
import io.netty.channel.socket.SocketChannel;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Component
public class EventDeliveryManager {

//    @Autowired
    public final ApplicationContext context = CustomSpringUtils.getApplicationContext();;

    /**
     * 分发事件
     * @param data
     * @param socketChannel
     */
//    @GetMapping("/RequestManager")
    public void RequestManager(GameData data, SocketChannel socketChannel){
//        System.out.println("准备发送事件");
        //context= CustomSpringUtils.getApplicationContext();
        context.publishEvent(new GameResquestEvent(data,socketChannel));
//        System.out.println("发送完毕...");
    }

}
